package com.example.administrator.yunniuusedcar.holder;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.administrator.common.ui.BaseAdapterRV;
import com.example.administrator.common.ui.BaseHolderRV;
import com.example.administrator.yunniuusedcar.R;
import com.example.administrator.yunniuusedcar.model.mode_benn.ZD_ArticleTopBean;
import com.squareup.picasso.Picasso;

/**  置顶文章 holder
 * Created by Administrator on 2017/12/21.
 */

 public class MainNewInfoHolder extends BaseHolderRV<ZD_ArticleTopBean.Data> {

    private ImageView ivBigNewHead;
    private TextView tvBigLeftTite;
    private ImageView ivZXnewTitle;
    private TextView tvBigRightTite;
    private ImageView minPager;
    private TextView tvMinRightTite;

    /**
     * 构造方法
     *
     * @param context     上下文对象
     * @param parent      指RecyclerView控件
     * @param adapter     适配器
     * 1@param layoutResId RecyclerView的一个item布局文件
     */
    public MainNewInfoHolder(Context context, ViewGroup parent, BaseAdapterRV<ZD_ArticleTopBean.Data> adapter) {
        super(context, parent, adapter, R.layout.fragment_choosecar02_news);
    }

    @Override
    public void onFindViews(View itemView) {  //找
        initFindViewBid();
    }

    @Override
    protected void onRefreshView(ZD_ArticleTopBean.Data bean1, int position) {   // 绑
        bean = (ZD_ArticleTopBean.Data)bean1;
        Picasso.with(context).load(bean.logo).into(ivBigNewHead);   //tu
        tvBigLeftTite.setText(bean.title);

        Picasso.with(context).load(bean.logo).into(ivZXnewTitle);   //tu
        tvBigRightTite.setText(bean.title);

        Picasso.with(context).load(bean.logo).into(ivZXnewTitle);
        tvBigRightTite.setText(bean.title);

        Picasso.with(context).load(bean.logo).into(minPager);
        tvMinRightTite.setText(bean.title);
    }

    private void initFindViewBid() {
        ivBigNewHead = itemView.findViewById(R.id.iv_bigNewHead);   //tu
        tvBigLeftTite = itemView.findViewById(R.id.tv_bigLeftTite);  //tuWen
        ivZXnewTitle = itemView.findViewById(R.id.iv_ZXnewTitle);    //右上图
        tvBigRightTite = itemView.findViewById(R.id.tv_bigRightTite);  // 右边上文
        minPager = itemView.findViewById(R.id.minPager);                //右下图
        tvMinRightTite = itemView.findViewById(R.id.tv_minRightTite);     // 右下wen
    }
}